package com.ats.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.ats.model.Classe;
import com.ats.model.User;
import com.ats.service.LeaveService_ty;
import com.ats.service.StudentService_xh;
import com.ats.serviceimpl.LeaveServiceIml_ty;
import com.ats.serviceimpl.StudentServiceImpl_xh;
/**
 *
 * @author TangRain
 *
 */
public class LeaveController_ty extends HttpServlet {
	LeaveService_ty ls =new LeaveServiceIml_ty();
	StudentService_xh stus = new StudentServiceImpl_xh();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
				doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	//设置字符集
		resp.setCharacterEncoding("utf8");
		HttpSession session =req.getSession();
		int uid =Integer.parseInt(req.getParameter("uid"));	
		String lreson=req.getParameter("lreson");
		String lnumber=req.getParameter("lnumber");
		String startDate=req.getParameter("startDate");
		String endDate=req.getParameter("endDate");
		String ldate=startDate+" 到 "+endDate;
		int sid =stus.findSidByUid(uid);
		int iid=ls.getiid(sid).getIid();
		ls.ApplyLeave(sid, lreson, lnumber, ldate,iid);
	}
}
